From 4a7f68e79e0c2a56eb1297e72a33cbdcd68418ba Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Fri, 10 Jan 2020 15:00:10 -0800 Subject: [PATCH] gtkmain: short-circuit gtk_main_sync() where no display If there is no display, we will hit the slow path here which can introduce long latencies in unit tests. This checks for a NULL list of displays and simply short-circuits. --- gtk/gtkmain.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c index fe5868a95d..93fea8540a 100644 --- a/gtk/gtkmain.c +++ b/gtk/gtkmain.c @@ -1081,6 +1081,9 @@ gtk_main_sync (void) /* Try storing all clipboard data we have */ displays = gdk_display_manager_list_displays (gdk_display_manager_get ()); + if (displays == NULL) + return; + cancel = g_cancellable_new (); for (l = displays; l; l = l->next) -- 2.30.2